@ GNU AS assembler header file for CompressJPEG
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:50:43 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 24 May 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef CompressJPEG_Hdr
#  define CompressJPEG_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_JPEG
#    define Get_JPEG
#    include "oslib/JPEG.Hdr"
#  endif

@Symbols for constants
#  define CompressJPEG_ControlTerminated 0x1
#  define CompressJPEG_SourceType 0x7
#  define CompressJPEG_SourceType1BPP 0x0
#  define CompressJPEG_SourceType2BPP 0x1
#  define CompressJPEG_SourceType4BPP 0x2
#  define CompressJPEG_SourceType8BPP 0x3
#  define CompressJPEG_SourceType16BPP 0x4
#  define CompressJPEG_SourceType32BPP 0x5
#  define CompressJPEG_SourceTypeRGBTriples 0x7
#  define CompressJPEG_HasDoubleEntries 0x8
#  define CompressJPEG_IgnoreHighByte 0x10
#  define CompressJPEG_IsRGB 0x20
#  define CompressJPEG_GenerateProgressive 0x1
#  define CompressJPEG_OperationOnUnknowns 0x6
#  define CompressJPEG_OperationOnUnknownsShift 0x1
#  define CompressJPEG_TransformationType 0x78
#  define CompressJPEG_TransformationTypeShift 0x3
#  define CompressJPEG_TrimEdges 0x80
#  define CompressJPEG_GenerateGreyscale 0x100
#  define CompressJPEG_OptimiseForSmaller 0x200
#  define CompressJPEG_CopyNoAdditional 0x0
#  define CompressJPEG_CopyComments 0x1
#  define CompressJPEG_CopyAllElements 0x3
#  define CompressJPEG_NoTransformation 0x0
#  define CompressJPEG_FlipHorizontally 0x1
#  define CompressJPEG_FlipVertically 0x2
#  define CompressJPEG_Rotate90Clockwise 0x3
#  define CompressJPEG_Rotate180 0x4
#  define CompressJPEG_Rotate90AntiClockwise 0x5
#  define CompressJPEG_Transpose 0x6
#  define CompressJPEG_TransverseTranspose 0x7
#  define Error_CompressJPEGBadBPP 0x8183c0
#  define Error_CompressJPEGBadLineCount 0x8183c1
#  define Error_CompressJPEGBadBuffer 0x8183c2
#  define Error_CompressJPEGBadSize 0x8183c3
#  define Error_CompressJPEGArithNotImpl 0x81a881
#  define Error_CompressJPEGBadAlignType 0x81a882
#  define Error_CompressJPEGBadAllocChunk 0x81a883
#  define Error_CompressJPEGBadBufferMode 0x81a884
#  define Error_CompressJPEGBadComponentID 0x81a885
#  define Error_CompressJPEGBadDctSize 0x81a886
#  define Error_CompressJPEGBadInColourSpace 0x81a887
#  define Error_CompressJPEGBadKColourSpace 0x81a888
#  define Error_CompressJPEGBadLength 0x81a889
#  define Error_CompressJPEGBadMCUSize 0x81a88a
#  define Error_CompressJPEGBadPoolID 0x81a88b
#  define Error_CompressJPEGBadPrecision 0x81a88c
#  define Error_CompressJPEGBadSampling 0x81a88d
#  define Error_CompressJPEGBadState 0x81a88e
#  define Error_CompressJPEGBadVirtualAccess 0x81a88f
#  define Error_CompressJPEGBufferSize 0x81a890
#  define Error_CompressJPEGCantSuspend 0x81a891
#  define Error_CompressJPEGCCIR601NotImpl 0x81a892
#  define Error_CompressJPEGComponentCount 0x81a893
#  define Error_CompressJPEGConversionNotImpl 0x81a894
#  define Error_CompressJPEGDACIndex 0x81a895
#  define Error_CompressJPEGDACValue 0x81a896
#  define Error_CompressJPEGDHTIndex 0x81a897
#  define Error_CompressJPEGDQTIndex 0x81a898
#  define Error_CompressJPEGEmptyImage 0x81a899
#  define Error_CompressJPEGEOIExpected 0x81a89a
#  define Error_CompressJPEGFileRead 0x81a89b
#  define Error_CompressJPEGFileWrite 0x81a89c
#  define Error_CompressJPEGFractSampleNotImpl 0x81a89d
#  define Error_CompressJPEGHuffCLenOverflow 0x81a89e
#  define Error_CompressJPEGHuffMissingCode 0x81a89f
#  define Error_CompressJPEGImageTooBig 0x81a8a0
#  define Error_CompressJPEGInputEmpty 0x81a8a1
#  define Error_CompressJPEGInputEOF 0x81a8a2
#  define Error_CompressJPEGNotImpl 0x81a8a3
#  define Error_CompressJPEGNotCompiled 0x81a8a4
#  define Error_CompressJPEGNoBackingStore 0x81a8a5
#  define Error_CompressJPEGNoHuffTable 0x81a8a6
#  define Error_CompressJPEGNoImage 0x81a8a7
#  define Error_CompressJPEGNoQuantTable 0x81a8a8
#  define Error_CompressJPEGNoSOI 0x81a8a9
#  define Error_CompressJPEGOutOfMemory 0x81a8aa
#  define Error_CompressJPEGQuantComponents 0x81a8ab
#  define Error_CompressJPEGQuantFewColours 0x81a8ac
#  define Error_CompressJPEGQuantManyColours 0x81a8ad
#  define Error_CompressJPEGSOFDuplicate 0x81a8ae
#  define Error_CompressJPEGSOFNoSOS 0x81a8af
#  define Error_CompressJPEGSOFUnsupported 0x81a8b0
#  define Error_CompressJPEGSOIDuplicate 0x81a8b1
#  define Error_CompressJPEGSOSNoSOF 0x81a8b2
#  define Error_CompressJPEGTooLittleData 0x81a8b3
#  define Error_CompressJPEGUnknownMarker 0x81a8b4
#  define Error_CompressJPEGVirtualBug 0x81a8b5
#  define Error_CompressJPEGWidthOverflow 0x81a8b6
#  define Error_CompressJPEGBadDCTCoef 0x81a8b7
#  define Error_CompressJPEGBadHuffTable 0x81a8b8
#  define Error_CompressJPEGBadProgression 0x81a8b9
#  define Error_CompressJPEGBadProgScript 0x81a8ba
#  define Error_CompressJPEGBadScanScript 0x81a8bb
#  define Error_CompressJPEGMismatchedQuantTable 0x81a8bc
#  define Error_CompressJPEGMissingData 0x81a8bd
#  define Error_CompressJPEGModeChange 0x81a8be
#  define Error_CompressJPEGWBufferSize 0x81a8bf

@Symbols for structure offsets and sizes
@ abstract type
#  define CompressJPEG_Tag 4

        .struct 0
CompressJPEG_Parameters_width  : .skip   Int
CompressJPEG_Parameters_height : .skip   Int
CompressJPEG_Parameters_quality: .skip   Int
CompressJPEG_Parameters_bytes_per_pixel: .skip   Int
CompressJPEG_Parameters_xdpi   : .skip   Int
CompressJPEG_Parameters_ydpi   : .skip   Int
CompressJPEG_Parameters        : 

        .struct 0
CompressJPEG_ScanDescription_scan_count: .skip   Int
CompressJPEG_ScanDescription_scan_data_components: .skip   Int
CompressJPEG_ScanDescription_scan_data_r: .skip   Int
CompressJPEG_ScanDescription_scan_data_g: .skip   Int
CompressJPEG_ScanDescription_scan_data_b: .skip   Int
CompressJPEG_ScanDescription_scan_data_ss: .skip   Int
CompressJPEG_ScanDescription_scan_data_se: .skip   Int
CompressJPEG_ScanDescription_scan_data_ah: .skip   Int
CompressJPEG_ScanDescription_scan_data_al: .skip   Int
CompressJPEG_ScanDescription   : 
        
        .altmacro
        .macro  CompressJPEG_ScanDescription_MEMBERS label
\label&_scan_count             : .skip   Int
        .endm
        
        .struct 0
        CompressJPEG_ScanDescription_MEMBERS CompressJPEG_ScanDescriptionBase
CompressJPEG_ScanDescriptionBase: 

        .struct 0
        .skip   Bits
CompressJPEG_CommentFlags      : 

        .struct 0
        .skip   Bits
CompressJPEG_WriteLineFlags    : 

        .struct 0
        .skip   Bits
CompressJPEG_TranscodeFlags    : 


@Symbols for SWI's and SWI reason codes
.set XCompressJPEG_Start,0x6a500
.set CompressJPEG_Start,0x4a500
   @Entry
   @  R0 -> image (JPEG_Image)
   @  R1 = image_size (Int)
   @  R2 -> parameters (CompressJPEG_Parameters)
   @  R3 = workspace (pointer to Void)
   @  R4 = workspace_size (Int)
   @Exit
   @  R0 = tag (CompressJPEG_Tag)

.set XCompressJPEG_WriteLine,0x6a501
.set CompressJPEG_WriteLine,0x4a501
   @Entry
   @  R0 = tag (CompressJPEG_Tag)
   @  R1 -> pixels (data)

.set XCompressJPEG_Finish,0x6a502
.set CompressJPEG_Finish,0x4a502
   @Entry
   @  R0 = tag (CompressJPEG_Tag)
   @Exit
   @  R0 = image_size (Int)

.set XCompressJPEG_Comment,0x6a503
.set CompressJPEG_Comment,0x4a503
   @Entry
   @  R0 = tag (CompressJPEG_Tag)
   @  R1 = flags (CompressJPEG_CommentFlags)
   @  R2 -> comment (Char)
   @  R3 = comment_size (Int)

.set XCompressJPEG_WriteLineExtended,0x6a504
.set CompressJPEG_WriteLineExtended,0x4a504
   @Entry
   @  R0 = tag (CompressJPEG_Tag)
   @  R1 = flags (CompressJPEG_WriteLineFlags)
   @  R2 -> image_data (data)
   @  R3 -> palette_data (data)
   @  R4 = lines (Int)
   @  R5 = bytes_between_lines (Int)
   @Exit
   @  R2 -> image_data_end (data)
   @  R4 = lines_written (Int)

.set XCompressJPEG_Transcode,0x6a510
.set CompressJPEG_Transcode,0x4a510
   @Entry
   @  R0 = flags (CompressJPEG_TranscodeFlags)
   @  R1 -> source_data (data)
   @  R2 = source_size (Int)
   @  R3 = destination_data (pointer to data)
   @  R4 = destination_size (Int)
   @  R5 = workspace (pointer to data)
   @  R6 = workspace_size (Int)
   @  R7 -> scans (CompressJPEG_ScanDescription)
   @Exit
   @  R4 = out_destination_size (Int)
   @  R6 = out_workspace_size (Int)

#endif
